 
<!-- edit scripts -->   
<script language="javascript" src="scripts/_ps_editor.js"></script>
 

<div align="left">      

  
    <table width=200 cellpadding=0 id=tooltable cellspacing=0 border="0"> 
		<tr  bgcolor="aliceblue">
           <td width='12' bgcolor='white'>
		   <img src='index.php?i=o' align='absmiddle' onclick="rollup('tooltable')" id='imtooltable'
		   >
		   </td>
           <td>&nbsp;<a href="javascript:rollup('tooltable')" style='font:7pt tahoma;color:blue'><u>Tools</u></a>  
           </td>
        </tr> 
        <tr bgcolor="#FFFFFF">
           <td width='12' align="center" bgcolor='white'>
		   <img src='index.php?i=a' onload='heirsize("sptooltable")'  align='absmiddle' width='1' id='sptooltable'>
		   </td>
           <td nowrap> 
            <a id="ametric" onclick="SHOWMETRICS=!SHOWMETRICS;MM_findObj('ametric').innerText=SHOWMETRICS?'Metrics Off':'Metrics On'">Metrics Off</a>
			&nbsp;&nbsp;
			<a href="javascript:domport('<?= $editconfig ?>')"><img src="<?= $href ?>?i=pu" align="absmiddle" border="0">&nbsp;Import</a> 
			&nbsp;&nbsp;
			<a href="javascript:fb_edit('e','')"><img src="<?= $href ?>?i=e" align="absmiddle" border="0">&nbsp;Exit</a> 
           </td>
        </tr>
        <tr>
           <td width='12' align="center" bgcolor='white'>
		   <img src='index.php?i=a' onload='heirsize("sptooltable")'  align='absmiddle' width='1' id='sptooltable'>
		   </td>
           <td bgcolor=white align="center">
          
<table cellpadding="0" cellspacing="0">
   <tr>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
	</tr>
	<tr>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="45" width="1"></td>
<?

// edit controls
$config = file_to_array ("scripts/_ps_tools.js");
$tools   = 0;
$filters = 0;
$mdown   = 0;
$mchange = 0;
$msend   = 0;
$mload   = 0;
$mafter  = 0;
$mup     = 0;
$thisevent = "";
for ($e=0;$e<count($config);$e++) {
    $line = $config[$e];
	
    if (substr($line,0,5)=="event") {    
	   $arguments="";
	   parse_str($line); 
	   $mmove = -($mmove-1);	   
	   if ($mmove==1) print "\n<"."script language='javascript'>\n".trim($tool).".".trim($event)."=function (".trim($arguments).") { \n";  
	   if ($mmove==0) print "}\n<"."/script>";  	    
	} else if ($mmove==1) { 
	    print "    ".trim($line). "\n";  
    } else if (substr($line,0,6)=="filter") {
	   $filters ++;
		$option = "";
	    parse_str($line); ?>
		<script language="javascript">
		var <?= $filter ?> = new effect(); 
		<?= $filter ?>._name = "<?= $filter ?>";
		<?= $filter ?>._desc = "<?= trim($desc) ?>";
		<? if ($option!="") {
		  $ar = split(",",$option); ?>
		<?= $filter ?>._<?= $ar[0] ?> = "<?= trim($ar[1]) ?>";
		<? } ?>
		effects[effects.length]   = <?= $filter ?>;
		effects["<?= $filter ?>"] = <?= $filter ?>;
		</script>
		<?
	} else if (substr($line,0,4)=="tool") {
	    $tools ++;
		$option = array();
		$penspan="";
	   parse_str($line);
	   
	   if (($tools>1)&&(($tools-1)%4==0)) {
	   ?> 
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="45" width="1"></td>
	  <? } ?>
	   <td align=center id="cell<?= $tool ?>" onMouseDown="grab('<?= $tool ?>')">
	   <img src="<?= $icon ?>" onload='heirsize("sptooltable")'><br>
	   <small style="font-size:7pt"><?= $tool ?></small>
	   </td>
	    <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="45" width="1"></td>
		
		<script language="javascript">
		var <?= $tool ?> = new tool(); 
		<?= $tool ?>._brush = "<?= $tool ?>";
		<?= $tool ?>._icon = "<?= trim($icon) ?>";
		<?= $tool ?>._desc = "<?= trim($desc) ?>";
		<? if (trim($penspan)!="") { ?>
		    <?= $tool ?>._penspan = "<?= trim($penspan) ?>";
		<?  } ?>
		<? for ($i=0;$i<count($option);$i++) { 
			$params = split(",", $option[$i]); ?>
		    <?= $tool ?>._<?= $params[0]?> = "<?= trim($params[1]) ?>";
		<? } ?>
		tools[tools.length]   = <?= $tool ?>;
		tools["<?= $tool ?>"] = <?= $tool ?>;
		</script>
		
	   <?
	   if ($tools%4==0) {
	    ?> 
		</tr>
	   <tr>
		  <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
		</tr>
		<tr>
      
		<?
	   }
	} 
}



?>
		</tr>
	<!--   <tr>
		  <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="45"></td>
      <td bgcolor="gray"><img src="<?= $href ?>?i=px" height="1" width="1"></td>
		</tr> -->
</table>
<div id="tooldesc">Select a tool to begin.</div>
           </td>
        </tr>
</table>



<div id=optionspanel></div>
<div id=navigpanel></div> 
<div id=layerspanel></div>
<div id=historypanel></div>
         
		 
		 
		 
        <table width=200 cellpadding=0 id=savetable cellspacing=0>
        
		<tr  bgcolor="white">
           <td colspan="2"><img src='index.php?i=p' align='absmiddle' onclick="rollup('savetable');getsavepreview('jpeg')" id='imsavetable'
		   >&nbsp;<a href="javascript:rollup('savetable');getsavepreview('jpeg')" style='font:7pt tahoma;color:blue'><u>Save Options</u></a>  
           </td>
        </tr>
       
        <tr style="display:none">
           <td colspan="2" bgcolor=white align="center">
          
				 
				<img id=savepic src="gen.jpg"> 
           
           </td>
        </tr>
        <tr style="display:none">
           <td bgcolor=white nowrap>
           Save as: 
           </td>
           <td bgcolor=white >
          <input type="text" size=20 value="<?= filetitle($filename) ?>" id=isavename>
           </td>
        </tr>
       
        <tr style="display:none">
           <td bgcolor="white"  nowrap>
           Type: 
           </td>
           <td bgcolor="white" >
          <input type="radio" id="itypejpeg" onclick="getsavepreview('jpeg')" checked name="itype">JPG
          <input type="radio" id="itypepng" onclick="getsavepreview('png')" name=itype>PNG
          <input type="radio" id="itypegif" onclick="getsavepreview('gif')" name=itype>GIF
		  <div  id="savequal">
		  Quality:
		  <input type="text" size=2 value="75" onkeyup="getsavepreview('jpeg')" id=isavequal>
		  </div>
           </td>
        </tr>
        <tr style="display:none">
           <td colspan="2" bgcolor=white align="right">
          
				  <input type=button value="Save" onclick="saveimage()">
				  <input type=button value="Cancel" onclick="rollup('savetable')">
           
           </td>
        </tr>
       
       
        </table>
		

<div id="tracepanel" style="position:absolute;top:0;left:0;display:none"><? 
$fx="";
for ($f=0;$f<200;$f++) {
	$fx .= "<div id=tr".$f." style='position:absolute;top:0;left:0;'>";
	$fx .= "<img id='itx".$f."' width='50' height='50' src='images/brush.png'>";
	$fx .= "</div>";
}		
//print $fx; ?> 
</div>
<div id=brushpanel style="position:absolute;top:0;left:0;cursor:crosshair"></div>
<div id=zoompanel  style="position:absolute;top:0;left:0;border:solid 2px red;cursor:hand;display:none"></div>
<div id=fauxpanel  style="position:absolute;top:0;left:0;"></div>
<div id=marqpanel  style="position:absolute;top:0;left:0;border:solid 1px red;display:none"></div>
<div id=statpanel  style="position:absolute;top:0;left:0;border:solid 1px black;background-color:#FFFFCC;padding:2px" align="left"></div>
<div id=dprevpic   style="position:absolute;top:0;left:0;">


        <table width="132" cellpadding="2" id="avtable" cellspacing="0" style="border:solid 1px silver">
        
		<tr  bgcolor="white">
           <td colspan="2"><img src='index.php?i=p' align='absmiddle' onclick="rollup('avtable')" id='imavtable'
		   >&nbsp;<a href="javascript:rollup('avtable')" 
		   style='font:7pt tahoma;color:blue'><u>Thumbnail</u></a>  
           </td>
        </tr>
       
        <tr style="display:none">
           <td colspan="2" bgcolor="#CC3399" align="center">
          
				 
				<img src="gen.jpg" id=prevpic></div>
           
           </td>
        </tr>  
        <tr style="display:none">
           <td colspan="2" bgcolor="#CC3399" >
           
 <img src='index.php?i=pu' align=absmiddle> 
 <a href='thumbnail.php?fo=100&bg=FFFF33&ft=png&w=132&i=<?= $path.$filename ?>&ff=<?= filetitle($filename) ?>.png' 
 style='font:7pt tahoma;color:white'>Download avatar PNG</a><br> 
           </td>
        </tr>
       
        <tr>
           <td colspan="2" bgcolor=white>
               <div id="ddebug" style="color:gray">Watch window</div> 
           </td>
        </tr>
        </table>



</div>

 